package com.whims.MemoryError.StackOverflowError;

/**
 * 虚拟机栈和本地方法栈溢出
 * vm options: -Xss128k
 */
public class JavavmStackSOF {


    private int stackLength = 1;
    public void stackLeak(){
        stackLength++;
        stackLeak();
    }

    public static void main(String [] args) throws Throwable {
        JavavmStackSOF oom = new JavavmStackSOF();
        try {
            oom.stackLeak();
        }catch (Throwable e){
            System.out.println("stack length :" + oom.stackLength);
            throw e;
        }
    }


}
